package chapter05_array;

import java.util.Arrays;

/**
 * ClassName: TempText
 * Package: chapter05_array
 * Description:
 *
 * @Author 安思宇
 * @Create 2025/2/23 15:49
 */
public class TempText {
    public static void main(String[] args) {
        int[] arr1=new int[]{2,3,5,10,23,45,52,56,78,99};
        int[] arr2=new int[]{34,54,3,2,65,7,37,5,76,52};
        int[] arr3=new int[]{34,54,3,2,65,7,37,5,76,52};
        //1.数组的遍历
        System.out.println(Arrays.toString(arr1));
        //2.数组的快速排序
        Arrays.sort(arr2);
        System.out.println(Arrays.toString(arr2));
        //3.对数组进行二分查找
        //注意：使用的前提是数组必须是有序的
        System.out.println(Arrays.binarySearch(arr2,5));
        //4.比较两个数组是否相等
        System.out.println(arr3==arr2);//false
        //注意：“==”是赋什么比什么,arr1和arr2是引用数据类型，赋的是地址，所以不相等
        boolean isEquals= Arrays.equals(arr3,arr2);
        System.out.println(isEquals);//true



    }
}

